package com.qzxy.premiumhotelsystem.mapper;

import com.qzxy.premiumhotelsystem.domain.entity.Guests;
import com.qzxy.premiumhotelsystem.domain.entity.Logs;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
* @author iQNRen
* @description 针对表【logs】的数据库操作Mapper
* @createDate 2024-09-18 11:20:26
* @Entity com.qzxy.premiumhotelsystem.domain.entity.Logs
*/
@Mapper
public interface LogsMapper extends BaseMapper<Logs> {
    /**
     * 查询所有日志
     * @return
     */
    @Select("select * from logs")
    List<Logs> allLogs();

    /**
     * 查询所有日志倒叙
     * @return
     */
    @Select("select * from logs ORDER BY create_time DESC;")
    List<Logs> allLogsDesc();


    /**
     * 插入日志
     * @param logLevel
     * @param logUser
     * @param logContent
     * @return
     */
    @Insert("insert into logs(log_level,log_user,log_content) values (#{logLevel},#{logUser},#{logContent})")
    boolean create(String logLevel,String logUser,String logContent);

    /**
     * 根据id删除日志
     * @param logId
     * @return
     */
    @Delete("delete from logs where log_id = #{logId}")
    boolean delByLogIdBoolean(String logId);


    /**
     * 根据id更新日志
     * @param logs
     * @return
     */
    @Update("update logs set log_level = #{logLevel}, log_user = #{logUser}, log_content=#{logContent} where log_id = #{logId}")
    boolean updateIdBoolean(Logs logs);
}




